package com.luolin;

import java.util.Set;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations="classpath:spring/applicationContext-redis.xml")
public class SetDemo2 {
	
	@Autowired
	private RedisTemplate redisTemplate;
	
	@Test
	public void addSet(){
		redisTemplate.boundSetOps("nameSet").add("A");
		redisTemplate.boundSetOps("nameSet").add("B");
		redisTemplate.boundSetOps("nameSet").add("C");
	}
	@Test
	public void get(){
		Set set = redisTemplate.boundSetOps("nameSet").members();
		System.out.println(set);
	}
	@Test
	public void del(){
		redisTemplate.boundSetOps("nameSet").remove("B");
	}
	@Test
	public void delAll(){
		redisTemplate.delete("nameSet");
	}

}
